/*
 * @Date: 2025-02-07 10:41:46
 * @LastEditors: zl 1077167261@qq.com
 * @LastEditTime: 2025-02-13 19:45:56
 * @FilePath: \vue-admin\src\api\System.js
 */
/*
 * @Date: 2025-02-07 10:41:46
 * @LastEditors: zl 1077167261@qq.com
 * @LastEditTime: 2025-02-10 20:21:16
 * @FilePath: \vue-admin\src\api\System.js
 */
import request from "@/utils/request";
//1-------------------------------------------------------------角色管理
/**
 * 获取角色列表
 */
export function getRoleListAPI() {
  return request({
    url: "/park/sys/role",
  });
}
/**
 * 获取tree权限列表
 * @returns
 */
export function getTreeListAPI() {
  return request({
    url: "/park/sys/permision/all/tree",
  });
}
/**
 * 获取当前角色权限点列表
 * @returns
 */
export function getRoleDetailAPI(roleId) {
  return request({
    url: `/park/sys/role/${roleId}`,
  });
}
/**
 * 获取角色成员列表
 * @returns
 */
export function getRoleUserAPI(roleId) {
  return request({
    url: `/park/sys/roleUser/${roleId}`,
  });
}
/**
 * 创建角色
 * @returns
 */
export function createRoleUserAPI(data) {
  return request({
    url: `/park/sys/role`,
    method: "POST",
    data,
  });
}
/**
 * 更改角色
 * @returns
 */
export function updateRoleAPI(data) {
  return request({
    url: `/park/sys/role`,
    method: "PUT",
    data,
  });
}
/**
 * 删除角色
 * @returns
 */
export function delRoleUserAPI(roleId) {
  return request({
    url: `/park/sys/role/${roleId}`,
    method: "DELETE",
  });
}

// 2------------------------------------------------------------员工管理
/**
 * 获取员工列表
 * @param { page, pageSize, name} params
 * @returns
 */
export function getEmployeeListAPI(params) {
  return request({
    url: "/park/sys/user",
    params,
  });
}

/**
 * 添加员工
 * @returns
 */
export function createEmployeeAPI(data) {
  return request({
    url: `/park/sys/user`,
    method: "POST",
    data,
  });
}
/**
 * 删除员工
 * @returns
 */
export function delEmployeeAPI(id) {
  return request({
    url: `/park/sys/user/${id}`,
    method: "DELETE",
  });
}
/**
 * 修改员工
 * @returns
 */
export function changeEmployeeAPI(data) {
  return request({
    url: `/park/sys/user`,
    method: "PUT",
    data,
  });
}

/**
 * 获取用户详情
 * @returns
 */
export function getEmployeeAPI(id) {
  return request({
    url: `/park/sys/user/${id}`,
  });
}
/**
 * 重置密码
 * @returns
 */
export function resetPwdAPI(data) {
  return request({
    url: `park/sys/user/resetPwd`,
    method: "PUT",
    data,
  });
}
